import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";

// 配置axios
import axios from "axios";

import "./plugins/element.js";

Vue.prototype.$http = axios;
// axios.defaults.baseURL = "locolhost:8080";
axios.interceptors.request.use((config) => {
  // console.log(config)
  config.headers.Authorization = sessionStorage.getItem("token");
  // 在最后必须 return config
  return config;
});
Vue.config.productionTip = false;

new Vue({
  router,
  store,
  render: (h) => h(App),
  beforeCreate() {
    Vue.prototype.$bus = this; //安装全局事件总线，$bus就是当前应用的vm
  }
}).$mount("#app");
